<?php
require_once('bootstrap.php');
require_once('src/Stats.php');
require_once('src/Cache.php');

class BaseService {
  
  protected $manager; 
  protected $conn;  
  protected $statsParser;
  protected $cache;      
  
  public function __construct() {
    $this->manager = Doctrine_Manager::getInstance();
    $this->conn = $this->manager->getCurrentConnection();
    $this->statsParser = new Stats();
    $this->cache = new Cache();
  }
  
  public function transformObjectsToVO($array, $clazz) { 
     $results = array();
     
     foreach($array as $o) {
          $obj = new $clazz;
          $obj->updateFromObject($o);    
          array_push($results, $obj);  
     }
     
     return $results;  
     
  }
  
  public function transformArrayToVO($array, $clazz) { 
     $results = array();
     
     foreach($array as $arr) {
          $obj = new $clazz;
          $obj->updateFromArray($arr);    
          array_push($results, $obj);  
     }
     
     return $results;  
     
  }  
    
}

?>